<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>APP开发UI规范 | 孙加俊的个人博客</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/sjj-blog/favicon.ico">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/sjj-blog/assets/css/0.styles.a5cb6817.css" as="style"><link rel="preload" href="/sjj-blog/assets/js/app.ab5bad9b.js" as="script"><link rel="preload" href="/sjj-blog/assets/js/3.136f62ef.js" as="script"><link rel="preload" href="/sjj-blog/assets/js/1.a27fba8e.js" as="script"><link rel="preload" href="/sjj-blog/assets/js/8.f6b78670.js" as="script"><link rel="prefetch" href="/sjj-blog/assets/js/10.9271e5b8.js"><link rel="prefetch" href="/sjj-blog/assets/js/11.67b9ea44.js"><link rel="prefetch" href="/sjj-blog/assets/js/12.f69e6353.js"><link rel="prefetch" href="/sjj-blog/assets/js/13.ace41b19.js"><link rel="prefetch" href="/sjj-blog/assets/js/14.78670b1e.js"><link rel="prefetch" href="/sjj-blog/assets/js/15.b0aaec82.js"><link rel="prefetch" href="/sjj-blog/assets/js/16.f0d479dc.js"><link rel="prefetch" href="/sjj-blog/assets/js/17.1bacbab3.js"><link rel="prefetch" href="/sjj-blog/assets/js/18.2237a65f.js"><link rel="prefetch" href="/sjj-blog/assets/js/19.7e0f4bf8.js"><link rel="prefetch" href="/sjj-blog/assets/js/20.5c098df8.js"><link rel="prefetch" href="/sjj-blog/assets/js/21.45bd5038.js"><link rel="prefetch" href="/sjj-blog/assets/js/4.cc582e42.js"><link rel="prefetch" href="/sjj-blog/assets/js/5.9c9443fe.js"><link rel="prefetch" href="/sjj-blog/assets/js/6.370fb6dd.js"><link rel="prefetch" href="/sjj-blog/assets/js/7.e5d26899.js"><link rel="prefetch" href="/sjj-blog/assets/js/9.d915a2b8.js">
    <link rel="stylesheet" href="/sjj-blog/assets/css/0.styles.a5cb6817.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar" data-v-1aefc0b4><div data-v-1aefc0b4><div id="loader-wrapper" class="loading-wrapper" data-v-d48f4d20 data-v-1aefc0b4 data-v-1aefc0b4><div class="loader-main" data-v-d48f4d20><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-25ba6db2 data-v-1aefc0b4 data-v-1aefc0b4><h3 class="title" data-v-25ba6db2 data-v-25ba6db2>孙加俊的个人博客</h3> <p class="description" data-v-25ba6db2 data-v-25ba6db2></p> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><span data-v-25ba6db2>孙加俊</span>
            
          <span data-v-25ba6db2>2017 - </span>
          2023
        </a></span></div></div> <div class="hide" data-v-1aefc0b4><header class="navbar" data-v-1aefc0b4><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/sjj-blog/" class="home-link router-link-active"><img src="/sjj-blog/logo.png" alt="孙加俊的个人博客" class="logo"> <span class="site-name">孙加俊的个人博客</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/sjj-blog/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      技术栈
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/sjj-blog/categories/规范/" class="nav-link"><i class="undefined"></i>
  规范
</a></li><li class="dropdown-item"><!----> <a href="/sjj-blog/categories/原生JS/" class="nav-link"><i class="undefined"></i>
  原生JS
</a></li></ul></div></div><div class="nav-item"><a href="/sjj-blog/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      文档
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/sjj-blog/docs/theme-reco/" class="nav-link"><i class="undefined"></i>
  vuepress-reco
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      联系我
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/sir-jun" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-1aefc0b4></div> <aside class="sidebar" data-v-1aefc0b4><div class="personal-info-wrapper" data-v-39576ba9 data-v-1aefc0b4><img src="/sjj-blog/avatar.png" alt="author-avatar" class="personal-img" data-v-39576ba9> <h3 class="name" data-v-39576ba9>
    孙加俊
  </h3> <div class="num" data-v-39576ba9><div data-v-39576ba9><h3 data-v-39576ba9>11</h3> <h6 data-v-39576ba9>Articles</h6></div> <div data-v-39576ba9><h3 data-v-39576ba9>3</h3> <h6 data-v-39576ba9>Tags</h6></div></div> <ul class="social-links" data-v-39576ba9></ul> <hr data-v-39576ba9></div> <nav class="nav-links"><div class="nav-item"><a href="/sjj-blog/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      技术栈
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/sjj-blog/categories/规范/" class="nav-link"><i class="undefined"></i>
  规范
</a></li><li class="dropdown-item"><!----> <a href="/sjj-blog/categories/原生JS/" class="nav-link"><i class="undefined"></i>
  原生JS
</a></li></ul></div></div><div class="nav-item"><a href="/sjj-blog/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      文档
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/sjj-blog/docs/theme-reco/" class="nav-link"><i class="undefined"></i>
  vuepress-reco
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      联系我
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/sir-jun" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav> <!----> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-25ba6db2 data-v-1aefc0b4><h3 class="title" data-v-25ba6db2 data-v-25ba6db2></h3> <!----> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><span data-v-25ba6db2>孙加俊</span>
            
          <span data-v-25ba6db2>2017 - </span>
          2023
        </a></span></div></div> <div data-v-1aefc0b4><main class="page"><section><div class="page-title"><h1 class="title">APP开发UI规范</h1> <div data-v-f875f3fc><i class="iconfont reco-account" data-v-f875f3fc><span data-v-f875f3fc>孙加俊</span></i> <!----> <!----> <!----></div></div> <div class="theme-reco-content content__default"><h1 id="app开发ui规范"><a href="#app开发ui规范" class="header-anchor">#</a> APP开发UI规范</h1> <h3 id="字重"><a href="#字重" class="header-anchor">#</a> 字重</h3> <p>uni中正常字体不用加font-weight，设计稿上500/600的在css代码中固定使用bold（很多手机不认数字字重）</p> <div class="language-css extra-class"><pre class="language-css"><code><span class="token property">font-weight</span><span class="token punctuation">:</span> 400<span class="token punctuation">;</span> // ×  即默认字重 不用加

<span class="token property">font-weight</span><span class="token punctuation">:</span> 500<span class="token punctuation">;</span>   //×
<span class="token property">font-weight</span><span class="token punctuation">:</span> 600<span class="token punctuation">;</span>   //×
<span class="token property">font-weight</span><span class="token punctuation">:</span> bold<span class="token punctuation">;</span>  // √
</code></pre></div><h3 id="字体"><a href="#字体" class="header-anchor">#</a> 字体</h3> <p>本元app中不需定义字体，安卓和ios各自使用自己默认的字体，已与UI确定</p> <div class="language-css extra-class"><pre class="language-css"><code><span class="token property">font-family</span><span class="token punctuation">:</span> PingFangSC<span class="token punctuation">,</span> PingFang SC<span class="token punctuation">;</span>  //x
</code></pre></div><blockquote><p>以下为页面高度设计要注意的点</p></blockquote> <h3 id="示例图片"><a href="#示例图片" class="header-anchor">#</a> 示例图片</h3> <p><img src="/sjj-blog/assets/img/01.b143a42c.png" alt="iamge"></p> <h3 id="头部状态栏-上图中的1"><a href="#头部状态栏-上图中的1" class="header-anchor">#</a> 头部状态栏（上图中的1）</h3> <p>每个手机都带的状态栏高度，本系统中两种获取方法</p> <div class="language-css extra-class"><pre class="language-css"><code> 1<span class="token punctuation">:</span> 直接写在css中 
<span class="token property">height</span><span class="token punctuation">:</span> <span class="token function">var</span><span class="token punctuation">(</span>--status-bar-height<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><div class="language-js extra-class"><pre class="language-js"><code><span class="token number">2</span><span class="token operator">:</span>在逻辑中使用 单位px
<span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
     	 <span class="token literal-property property">topHeight</span><span class="token operator">:</span> <span class="token function">getApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>globalData<span class="token punctuation">.</span>topHeight<span class="token punctuation">,</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>  
</code></pre></div><h3 id="头部标题-上图中的2"><a href="#头部标题-上图中的2" class="header-anchor">#</a> 头部标题（上图中的2）</h3> <p>组件中的baseHeader可以满足大部分需要（里面已经计算好了状态栏高度并且有和其同等高度的空白盒子撑起高度，直接往下排其他元素即可），如这个不能满足的自定义头部切需要fixed定位，假如高度为100，则样式应该为</p> <div class="language-html extra-class"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>view</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>header<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span> xxx <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>view</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>view</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>white<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span> 
</code></pre></div><div class="language-css extra-class"><pre class="language-css"><code><span class="token selector">//展示的头部样式
.header</span><span class="token punctuation">{</span>
    <span class="token property">width</span><span class="token punctuation">:</span> 750rpx<span class="token punctuation">;</span>
    <span class="token property">height</span><span class="token punctuation">:</span> 100rpx<span class="token punctuation">;</span>
    <span class="token property">padding-top</span><span class="token punctuation">:</span> <span class="token function">var</span><span class="token punctuation">(</span>--status-bar-height<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token property">position</span><span class="token punctuation">:</span> fixed<span class="token punctuation">;</span>
    <span class="token property">top</span><span class="token punctuation">:</span> 0<span class="token punctuation">;</span>
    <span class="token property">left</span><span class="token punctuation">:</span> 0
<span class="token punctuation">}</span>
<span class="token selector">//撑起头部高度的空白盒子样式
.white</span><span class="token punctuation">{</span>
    <span class="token property">height</span><span class="token punctuation">:</span><span class="token function">calc</span><span class="token punctuation">(</span>100px + <span class="token function">var</span><span class="token punctuation">(</span>--status-bar-height<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
</code></pre></div><h3 id="底部输入框-操作按钮组-上图中的4"><a href="#底部输入框-操作按钮组-上图中的4" class="header-anchor">#</a> 底部输入框/操作按钮组（上图中的4）</h3> <p>很多页面/组件有底部操作按钮，此处为了兼容安卓ios都应该加上底部安全区，为了方便计算建议高度写死，再加上安全区高度的padding-bottom。</p> <p>在安卓中应该时这种形式</p> <p><img src="/sjj-blog/assets/img/02.a212d658.png" alt="iamge"></p> <p>在ios中应该是这种形式（底部padding和上部不一样而是safe-bottom的高度）</p> <p><img src="/sjj-blog/assets/img/06.9a6ee3d1.png" alt="iamge"></p> <p>如图：与UI确定以后按钮高度96，上下留白为22，左右留白98，则此处兼容安卓和ios的代码应为</p> <div class="language-css extra-class"><pre class="language-css"><code><span class="token selector">.box</span><span class="token punctuation">{</span>
    <span class="token property">width</span><span class="token punctuation">:</span> 554rpx<span class="token punctuation">;</span>//<span class="token punctuation">(</span><span class="token property">不建议使用box-sizing</span><span class="token punctuation">:</span>border-box<span class="token punctuation">,</span>故此处应为<span class="token punctuation">,</span>750-98*2，使用box-sizing则高度需要动态计算<span class="token punctuation">)</span>
    <span class="token property">height</span><span class="token punctuation">:</span> 96rpx<span class="token punctuation">;</span>//height为按钮高度，而非安卓中整个框的高度
    <span class="token property">padding</span><span class="token punctuation">:</span> 22rpx 98rpx<span class="token punctuation">;</span>
    <span class="token property">position</span><span class="token punctuation">:</span> fixed<span class="token punctuation">;</span>
    <span class="token property">left</span><span class="token punctuation">:</span> 0<span class="token punctuation">;</span>
    <span class="token property">bottom</span><span class="token punctuation">:</span> 0
<span class="token punctuation">}</span>
</code></pre></div><div class="language-html extra-class"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>view</span>
	<span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>box<span class="token punctuation">&quot;</span></span>
	<span class="token attr-name">:style</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>{ paddingBottom: isIphone ? safeBottom + <span class="token punctuation">'</span>px<span class="token punctuation">'</span> : <span class="token punctuation">'</span>22rpx<span class="token punctuation">'</span> }<span class="token punctuation">&quot;</span></span>
<span class="token punctuation">&gt;</span></span>
    xxx
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>view</span><span class="token punctuation">&gt;</span></span>

data() {
    return {
     	 safeBottom: getApp().globalData.safeBottom,
		 isIphone: getApp().globalData.isIphone,
    }
  }, 
</code></pre></div><p>此处写法只是一个建议，可以根据实际情况进行调整，但切记安全区的高度不能漏掉！</p> <h3 id="底部安全区域-上图中的5"><a href="#底部安全区域-上图中的5" class="header-anchor">#</a> 底部安全区域（上图中的5）</h3> <p>ios手机和个别安卓机带的底部安全区，本系统两种获取方法</p> <div class="language-css extra-class"><pre class="language-css"><code> 1<span class="token punctuation">:</span>直接在css中使用
 <span class="token property">padding-bottom</span><span class="token punctuation">:</span> <span class="token function">constant</span><span class="token punctuation">(</span>safe-area-inset-bottom<span class="token punctuation">)</span><span class="token punctuation">;</span>
 <span class="token property">padding-bottom</span><span class="token punctuation">:</span> <span class="token function">env</span><span class="token punctuation">(</span>safe-area-inset-bottom<span class="token punctuation">)</span><span class="token punctuation">;</span>  //两个都要写是为了兼容不同版本的ios
  
 <span class="token atrule"><span class="token rule">@include</span> safe-bottom<span class="token punctuation">;</span></span>   //系统中uni.scss封了混入可直接通过这个引用
</code></pre></div><div class="language-js extra-class"><pre class="language-js"><code><span class="token number">2</span><span class="token operator">:</span>在逻辑中使用 单位px
<span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
     	 <span class="token literal-property property">safeBottom</span><span class="token operator">:</span> <span class="token function">getApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>globalData<span class="token punctuation">.</span>safeBottom<span class="token punctuation">,</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span> 
</code></pre></div><h3 id=""><a href="#" class="header-anchor">#</a></h3> <h3 id="定高滚动区域高度计算-上图中的3"><a href="#定高滚动区域高度计算-上图中的3" class="header-anchor">#</a> 定高滚动区域高度计算（上图中的3）</h3> <p>如图所示如果该区域使用scroll-view，那么高度需要定为100vh - 1,2,4,5的高度</p> <p>因安卓和ios底部高度不一样，css中无法判断安卓和ios所以只有一种方式写</p> <p>假如头部80 底部96+22+22 = 140</p> <p>则安卓中的高度为：100vh - 220rpx -  状态栏高度 - 安全区高度 (为0)</p> <p>ios中的高度为：100vh - 220rpx - 状态栏高度 - 安全区高度 + 安卓中下padding的高度22rpx（因为220里多算了个22，这块不理解的去看4）</p> <p>一定要注意状态栏和安全区的高度单位为px</p> <div class="language-html extra-class"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>view</span>
	<span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>content<span class="token punctuation">&quot;</span></span>
	<span class="token attr-name"><span class="token namespace">height:</span></span> <span class="token attr-name">`calc(100vh</span> <span class="token attr-name">-</span> <span class="token attr-name">220rpx</span> <span class="token attr-name">-</span> <span class="token attr-name">${topHeight</span> <span class="token attr-name">+</span> <span class="token attr-name">safeBottom}px</span> <span class="token attr-name">+</span> <span class="token attr-name"><span class="token namespace">${isIphone?'22rpx':</span>''})`,</span>
<span class="token punctuation">&gt;</span></span>
    xxx
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>view</span><span class="token punctuation">&gt;</span></span>
</code></pre></div><div class="language-js extra-class"><pre class="language-js"><code><span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
     	<span class="token literal-property property">topHeight</span><span class="token operator">:</span> <span class="token function">getApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>globalData<span class="token punctuation">.</span>topHeight<span class="token punctuation">,</span>
     	<span class="token literal-property property">safeBottom</span><span class="token operator">:</span> <span class="token function">getApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>globalData<span class="token punctuation">.</span>safeBottom<span class="token punctuation">,</span>
        <span class="token literal-property property">isIphone</span><span class="token operator">:</span> <span class="token function">getApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>globalData<span class="token punctuation">.</span>isIphone<span class="token punctuation">,</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span> 
</code></pre></div><p>根据情况选择合适的方法计算</p> <blockquote><p>需要注意的是当页面里包含uni的tabbar时100vh的高度为红色方块区域，不包含下方的tabbar和安全区，键盘弹起的时候同理，这两种情况需要特殊处理</p></blockquote> <p><img src="/sjj-blog/assets/img/03.4ea9a86f.png" alt="iamge"></p> <h3 id="_1像素处理"><a href="#_1像素处理" class="header-anchor">#</a> 1像素处理</h3> <p>1rpx在ios没有问题在安卓真机中会变成两像素的线条，之后一像素的线条统一使用0.5px，示例：</p> <div class="language-css extra-class"><pre class="language-css"><code><span class="token property">border-bottom</span><span class="token punctuation">:</span> 0.5px solid grey<span class="token punctuation">;</span>
</code></pre></div><h3 id="暂无数据位置"><a href="#暂无数据位置" class="header-anchor">#</a> 暂无数据位置</h3> <p>暂无数据的位置定为整个屏幕的中心位置，全局有class  globalNoData，只有一个简单图片可参考以下示例：</p> <div class="language-html extra-class"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>template</span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>view</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>content<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>view</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>list<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-for</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>item in listData<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            xxx
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>view</span><span class="token punctuation">&gt;</span></span>
        //关键代码就这一行
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>image</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>/static/images/noData.png<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-if</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>!listData.length<span class="token punctuation">&quot;</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>globalNoData<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>view</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>template</span><span class="token punctuation">&gt;</span></span>
</code></pre></div><p><img src="/sjj-blog/assets/img/04.c90c5baa.png" alt="iamge"></p> <h3 id="列表最后一项闭合"><a href="#列表最后一项闭合" class="header-anchor">#</a> 列表最后一项闭合</h3> <p>所有列表如果有带不闭合的下划线，最后一项把下划线闭合掉，即两头顶头（tips：可隐藏最后一个下划线，在外层盒子加个）</p> <p><img src="/sjj-blog/assets/img/05.6eaa76e8.png" alt="iamge"></p></div></section> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">12/27/2023, 10:21:34 AM</span></div></footer> <!----> <div class="comments-wrapper"><!----></div> <ul class="side-bar sub-sidebar-wrapper" style="width:12rem;" data-v-cb1513f6><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#字重" class="sidebar-link reco-side-字重" data-v-cb1513f6>字重</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#字体" class="sidebar-link reco-side-字体" data-v-cb1513f6>字体</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#示例图片" class="sidebar-link reco-side-示例图片" data-v-cb1513f6>示例图片</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#头部状态栏-上图中的1" class="sidebar-link reco-side-头部状态栏-上图中的1" data-v-cb1513f6>头部状态栏（上图中的1）</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#头部标题-上图中的2" class="sidebar-link reco-side-头部标题-上图中的2" data-v-cb1513f6>头部标题（上图中的2）</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#底部输入框-操作按钮组-上图中的4" class="sidebar-link reco-side-底部输入框-操作按钮组-上图中的4" data-v-cb1513f6>底部输入框/操作按钮组（上图中的4）</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#底部安全区域-上图中的5" class="sidebar-link reco-side-底部安全区域-上图中的5" data-v-cb1513f6>底部安全区域（上图中的5）</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#" class="sidebar-link reco-side-" data-v-cb1513f6></a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#定高滚动区域高度计算-上图中的3" class="sidebar-link reco-side-定高滚动区域高度计算-上图中的3" data-v-cb1513f6>定高滚动区域高度计算（上图中的3）</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#_1像素处理" class="sidebar-link reco-side-_1像素处理" data-v-cb1513f6>1像素处理</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#暂无数据位置" class="sidebar-link reco-side-暂无数据位置" data-v-cb1513f6>暂无数据位置</a></li><li class="level-3" data-v-cb1513f6><a href="/sjj-blog/blogs/standards/APP-UI-standards.html#列表最后一项闭合" class="sidebar-link reco-side-列表最后一项闭合" data-v-cb1513f6>列表最后一项闭合</a></li></ul></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div></div></div>
    <script src="/sjj-blog/assets/js/app.ab5bad9b.js" defer></script><script src="/sjj-blog/assets/js/3.136f62ef.js" defer></script><script src="/sjj-blog/assets/js/1.a27fba8e.js" defer></script><script src="/sjj-blog/assets/js/8.f6b78670.js" defer></script>
  </body>
</html>
